Organization of the CPU

🖥️ ⚙️ 🧠

The Brain of the Computer

The Central Processing Unit (CPU) is the "brain" of a computer.

Its job is to execute instructions and process data.

The CPU is made up of several components that work together in a cycle: fetch → decode → execute → store.

Control Unit (CU)
Arithmetic Logic Unit (ALU)
Registers
Cache Memory
1/6

🔹 Main Components of the CPU (Part 1)

1. Arithmetic Logic Unit (ALU)

Performs arithmetic operations: addition, subtraction, multiplication, division.

Performs logical operations: AND, OR, NOT, XOR, comparisons (>, <, =)

Works directly with data stored in registers.

👉 Example: If the instruction is C = A + B, the ALU adds the values of A and B and stores the result in C.

2. Control Unit (CU)

Acts like a manager/traffic controller of the CPU.

Fetches instructions from memory, decodes them, and sends signals to ALU, registers, and memory.

Controls data flow within the CPU and between CPU & other parts of the computer.

👉 Example: When a program says "Add A and B", the CU tells registers to load A and B, ALU to perform addition, and where to store the result.

2/6

🔹 Main Components of the CPU (Part 2)

3. Registers

Very small, very fast storage inside CPU.

Hold data, addresses, or instructions temporarily.

👉 Example: When executing C = A + B, values of A and B are loaded into registers before being sent to ALU.

Program Counter (PC)

Holds the address of the next instruction

Instruction Register (IR)

Holds the current instruction

Accumulator (ACC)

Stores intermediate results

MAR / MDR

Holds memory address and data

3/6

🔹 Main Components of the CPU (Part 3)

4. Cache Memory

A small, high-speed memory located inside or near the CPU.

Stores frequently used instructions/data to avoid slow access from main RAM.

Levels: L1 (fastest, smallest), L2, L3 (slower, bigger).

👉 Example: If a loop is running many times, the instructions and data are stored in cache so CPU doesn't fetch them repeatedly from RAM.

5. Buses

Communication channels that carry information:

  • Data Bus → transfers data.
  • Address Bus → carries memory addresses.
  • Control Bus → carries control signals (read/write/execute).

👉 Example: When A + B is executed, Address Bus points to memory locations of A and B, Data Bus carries their values to CPU, and Control Bus signals whether it's a read or write operation.

6. Clock

Generates timing signals to synchronize CPU operations.

Measured in Hertz (Hz) = cycles per second.

Faster clock = more instructions executed per second.

👉 Example: A CPU with 3 GHz clock can run ~3 billion cycles per second.

4/6

🔹 Interaction and Example

🔄 Interaction Between Components

  • CU fetches instruction from memory → stores in IR.
  • CU decodes the instruction → figures out operation + operands.
  • Registers provide quick storage for operands (data).
  • ALU executes the operation.
  • Result stored in register or memory.
  • Cache speeds up repeated access.
  • Buses move data between memory, I/O, and CPU.
  • Clock keeps everything in sync.

💻 Example in Context

Let's say we want the CPU to execute:

Instruction: C = A + B

1

Fetch

CU uses PC to fetch the instruction ADD A, B → C from memory into IR. PC increments to point to next instruction.

2

Decode

CU decodes instruction: operation = ADD, operands = A & B.

3

Execute

CU signals ALU: perform A + B. Registers hold A and B temporarily. ALU computes result.

4

Store

Result stored in register or memory location C.

5

Repeat

CU fetches next instruction using updated PC.

5/6

Summary

  • ALU = performs the work (math/logic).
  • CU = boss/manager, tells others what to do.
  • Registers = quick helpers, hold small amounts of data.
  • Cache = fast memory nearby.
  • Buses = communication wires.
  • Clock = timekeeper.
  • All work together in a cycle → Fetch → Decode → Execute → Store → Repeat.
⚙️

ALU

Performs calculations and logic operations

🎛️

Control Unit

Manages and coordinates operations

📋

Registers

Fast temporary storage

🚀

Cache

High-speed memory buffer

Control Unit (CU)
Arithmetic Logic Unit (ALU)
Registers
Cache Memory
6/6